package it.sd.pwframework.admin.bean;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import it.sd.pwframework.business.bean.PwForm;
import it.sd.pwframework.business.bean.PwRows;
import it.sd.pwframework.business.service.CommonService;

public class SelectorBean implements Serializable{
 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private PwForm form;
	private CommonService commonService;
	
    protected Logger log = LoggerFactory.getLogger(this.getClass());

	public SelectorBean(PwForm form, CommonService commonService) {
		super();
		this.form = form;
		this.commonService = commonService;
	}
	
	 public PwRows complete(String query) {  
	
		 PwRows rows = null;
		 try {
			 rows = commonService.retrieveRows(form);
		 } catch(Exception e) {
			 log.error("errore su recupero lista", e);
			 rows = new PwRows(form);
		 }
		 
		 return rows;  
	}
	
}
